Metal-to-metal bonding (also sometimes referred to as direct bonding) and solder bonding are commonly used bonding methods in the packaging of integrated circuits. In the direct bonding, the bond pads of two wafers or chips are bonded together without solder disposed in between. For example, the direct bonding may be a copper-to-copper bonding or a gold-to-gold bonding. In a typical direct bonding process, the metal bumps of a device die are aligned to, and are placed against, the metal bumps of a package substrate. A pressure is applied to press the device die and the package substrate against each other. During the bonding process, the device die and the package substrate are also heated. With the pressure and the elevated temperature, the surface portions of the metal bumps of the device die and the package substrate inter-diffuse, so that bonds are formed.